<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/inc/head.jsp"%>
<html>
<head>
<title>满洲里运输工具单一窗口</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="${basePath}/css/login.css">
<script src="${basePath}/js/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">

document.onkeydown=function(event) { 
	e = event ? event :(window.event ? window.event : null); 
	if(e.keyCode==13){ 
		//执行的方法 
		validate();
	} 
} 

function validate(){
	if(document.all.loginName.value == ""){
		$("#login-info").html("<font color='red'>请输入用户名！</font>");
		document.all.loginName.select();
		document.all.loginName.focus();
		return false;
	}
	if(document.all.password.value == ""){
		$("#login-info").html("<font color='red'>请输入密码！</font>");
   		$("#login-info").attr("style",""); 
		document.all.password.select();
		document.all.password.focus();
		return false;
	}
	$("#login-info").html("");
	$("#login-info").attr("style","");
    $.ajax({
        url:'${basePath}/login.do',
        type:'post',         
        data:"loginName="+$("#loginName").val()+"&password="+$("#password").val(), 
        dataType:"json",        
        success:function(msg){
        	$.each(msg,function(i,n){
        		if(n.message == "undefined"){
        			$("#login-info").html("<font color='red'>未知错误请联系管理员！</font>");
	           		$("#login-info").attr("style",""); 
        		}else if(n.message == "errorpwd"){
		        	$("#login-info").html("<font color='red'>密码错误！</font>");
		        	$("#login-info").attr("style",""); 
		        }else if(n.message == "usernotfound"){
		        	$("#login-info").html("<font color='red'>用户未找到！</font>");
		        	$("#login-info").attr("style",""); 
		        }else if(n.message == "userlock"){
		        	$("#login-info").html("<font color='red'>用户已经被锁定,不能登录！</font>");
		        	$("#login-info").attr("style",""); 
		        }else if(n.message == "failuremany"){
		        	$("#login-info").html("<font color='red'>登录失败次数过多！</font>");
		        	$("#login-info").attr("style",""); 
		        }else if(n.message == "usererror"){
		        	$("#login-info").html("<font color='red'>用户错误！</font>");
		        	$("#login-info").attr("style",""); 
		        }else if(n.message == "success"){
		 	        window.location.href = "${basePath}/main.do"; 
		        }
           });
             
       	}
     });
}


function init(){ 
	var ctrl=document.getElementById("loginName"); 
	ctrl.focus(); 
}
</script>
</head>

<body onload="init()">

<div class="loginWraper">
  	<div id="loginform" class="loginBox">
	  	<div class="cl" style="padding-left: 50px;">
	        <img src="${basePath}/images/login_title_logo.png" width="520px;" height="90px;">
	    </div>
	    <form class="form form-horizontal" action="" method="post">
	      <div class="row cl">
	        <label class="form-label col-3">
	        	<i class="Hui-iconfont">
	        		<img src="${basePath}/images/user.png" width="38px" height="35px">
	        	</i>
	        </label>
	        <div class="formControls col-8">
	          <input id="loginName" name="loginName" placeholder="账户" class="input-text size-L" type="text">
	        </div>
	      </div>
	      <div class="row cl">
	        <label class="form-label col-3">
	        	<i class="Hui-iconfont">
	        		<img src="${basePath}/images/lock.png" width="38px" height="35px">
	        	</i>
	        </label>
	        <div class="formControls col-8">
	          <input id="password" name="password" placeholder="密码" class="input-text size-L" type="password">
	        </div>
	      </div>
	      
	   <!--      <div class="row cl">
	      	<label class="form-label col-3">
	      		<i class="Hui-iconfont">
					<img src="${basePath}/images/verifyCode.png" width="38px" height="35px">
				</i>
	      	</label>
	   <div class="formControls col-8">
	        	<input id="verifyCode" name="verifyCode" placeholder="验证码" class="input-text size-L" type="text" style="width:150px;">
	            <img src="${basePath}/images/verifyCode-test.png"> <a id="kanbuq" href="javascript:;">看不清，换一张</a> </div>
	      </div>
	      <div class="row">
	        <div class="formControls col-8 col-offset-3">
	          <label for="online">
	            <input name="online" id="online" value="" type="checkbox">使我保持登录状态
	          </label>
	        </div>
	      </div> -->   
	      <div class="row">
	        <div class="formControls col-8 col-offset-3" style="padding-left: 60px;">
	          <input onclick="validate();" class="btn btn-success radius size-L" value="&nbsp;登&nbsp;&nbsp;&nbsp;&nbsp;录&nbsp;" type="button">
	          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	          <input class="btn btn-default radius size-L" value="&nbsp;取&nbsp;&nbsp;&nbsp;&nbsp;消&nbsp;" type="reset">
	        </div>
	      </div>
	    </form>
  	</div>
</div>
</body>
</html>
